<template>
	<view class="container">
		<view class="content">
			<view class="list" v-for="(item,index) in couponList" :key="index" @click="selectClick(index)">
				<view class="infos">
					<view class="user_info">满{{item.use_min_price}}元减{{item.coupon_price}}元
					</view>
					<view class="address">有效期：{{item.end_time}}</view>
				</view>
				<view class="select_box">选择</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				couponList: [],
				selectId: null,
				page: 1,
				pageSize: 10,
				count: 1,
				total: 1,
				status: 'loadmore',
				money: 0
			}
		},
		onLoad(opdata) {
			this.getData()
		},
		methods: {
			getData() {
				this.$allApi.userCouponList({
					types: 1,
				}).then(res => {
					this.couponList = res.data
				})
			},
			selectClick(index) {
				getApp().selectCoupon = JSON.stringify(this.couponList[index])
				this.$backTo()
			},
		}
	}
</script>

<style scoped lang="scss">
	.no {
		width: 40rpx;
		height: 40rpx;
		border-radius: 50%;
		border: 1px solid #ccc;
	}

	.container {
		min-height: 100vh;
		padding-bottom: 120rpx;
	}

	.list {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30rpx;
		border-bottom: 1px solid #eee;

		.select_box {
			width: 100rpx;
			height: 40rpx;
			border-radius: 8rpx;
			background: #eaf4eb;
			border: 2rpx solid #1A8A00;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #1A8A00;

		}

		.infos {
			flex: 1;

			.user_info {
				font-size: 30rpx;
				font-weight: 400;
				display: flex;
				justify-content: flex-start;
				align-items: center;

				view {
					width: 74rpx;
					height: 30rpx;
					border-radius: 30rpx;
					margin-left: 20rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 20rpx;
					color: #e2b771;
					background: linear-gradient(to right, #585858, #333);
					;
				}
			}

			.address {
				font-size: 24rpx;
				color: #999;
			}
		}
	}
</style>